<!DOCTYPE html>
<html>
<head>
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
</head>
<body>
<div id='testElement'></div>

<script>

testElement.style.left = '10px';

var t1 = async_test("Getting a 10px left results in a CSSUnitValue");
function t1Callback(computedStyleMap) {
  t1.step(function() {
    var result = computedStyleMap.get('left');
    assert_equals(result.constructor.name, CSSUnitValue.name);
    assert_equals(result.toString(), '10px');
  });
  t1.done();
}

var t2 = async_test("getAll for left returns a single value");
function t2Callback(computedStyleMap) {
  t2.step(function() {
    testElement.style.left = '20px';
    var result = computedStyleMap.getAll('left');
    assert_equals(result.length, 1);
    assert_equals(result[0].toString(), '20px');
  });
  t2.done();
}

document.onreadystatechange = function() {
  if (document.readyState == 'complete') {
    var computedStyleMap = testElement.computedStyleMap();
    t1Callback(computedStyleMap);
    t2Callback(computedStyleMap);
  }
};

</script>
</body>
</html>
